using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Model;
using IGlobalist.Cms.Common;

namespace IGlobalist.Cms.Admin
{
    public partial class Admanagement : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                IList<ICmsClass> cList = ClassController.GetClassListByClassTypeID((short)CmsObjectType.AdContent);
                ucClassList.DataSource = cList;
                ucClassList.DataBind();
                ucActionBar.ObjectTypeCurrent = CmsObjectType.AdContent;
                ucActionBarBottom.ObjectTypeCurrent = CmsObjectType.AdContent;
                ucActionBarBottom.SetupButton(ActionType.View);
                ucActionBar.SetupButton(ActionType.View);
            }
            ucActionBar.DeleteButtonClick += ucAdList.DoDelete;
            ucActionBar.DeleteButtonClick += ucAdList.DoShow;
            ucActionBar.DeleteButtonClick += ucAdAddEdit.DoHidden;
            ucActionBarBottom.DeleteButtonClick += ucAdList.DoDelete;
            ucActionBarBottom.DeleteButtonClick += ucAdList.DoShow;
            ucActionBarBottom.DeleteButtonClick += ucAdAddEdit.DoHidden;

            ucActionBar.SaveButtonClick += ucAdAddEdit.DoSave;
            ucActionBarBottom.SaveButtonClick += ucAdAddEdit.DoSave;
            ucAdAddEdit.SaveAd += ucAdList.DoShow;
            ucAdAddEdit.SaveAd += ucAdAddEdit.DoHidden;
            ucAdAddEdit.SaveAd += ucActionBar.DoViewClick;
            ucAdAddEdit.SaveAd += ucActionBarBottom.DoViewClick;

            ucClassList.TreeNodeClick += ucAdList.DoBindAd;
            ucClassList.TreeNodeClick += ucAdList.DoShow;
            ucClassList.TreeNodeClick += ucAdAddEdit.DoHidden;
            ucClassList.TreeNodeClick += HiddenInfo;
            ucClassList.TreeNodeClick += ucActionBar.DoViewClick;
            ucClassList.TreeNodeClick += ucActionBarBottom.DoViewClick;
            ucActionBar.NewButtonClick += ucAdAddEdit.DoNew;
            ucActionBar.NewButtonClick += ucAdList.DoHidden;
            ucActionBar.NewButtonClick += ucAdAddEdit.DoShow;
            ucActionBar.NewButtonClick += HiddenInfo;
            ucActionBar.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBar.NewButtonClick += ucActionBar.DoEditClassClick;
            ucActionBarBottom.NewButtonClick += ucAdAddEdit.DoNew;
            ucActionBarBottom.NewButtonClick += ucAdList.DoHidden;
            ucActionBarBottom.NewButtonClick += ucAdAddEdit.DoShow;
            ucActionBarBottom.NewButtonClick += HiddenInfo;
            ucActionBarBottom.NewButtonClick += ucActionBarBottom.DoEditClassClick;
            ucActionBarBottom.NewButtonClick += ucActionBar.DoEditClassClick;


            ucAdList.EditAd += ucAdAddEdit.DoEditAd;
            ucAdList.EditAd += ucAdList.DoHidden;
            ucAdList.EditAd += ucAdAddEdit.DoShow;

            ucAdList.EditAd += ucActionBar.DoEditClassClick;
            ucAdList.EditAd += ucActionBarBottom.DoEditClassClick;
		
        }
        public void HiddenInfo(object sender, EventArgs e)
        {
            pnlInfo.Visible = false;
        }
    }
}
